﻿
var curTxt = "";
var publish_editor = null;
var checkTxtLen = function () {
    if (curTxt != publish_editor.value) {
        curTxt = publish_editor.value;
        var normal = "你还可以输入<span class=\"pipsLim\">0</span>字";
        var error = "<div class=\"word_c\"><img class=\"tipicon tip2\" alt=\"\" title=\"\" src=\"/Content/Image/transparent.gif\"><strong>已超出<span>1</span>字</strong></div><b class=\"rcorner\"></b>";
        var curLen = App.getTxtLen($("#publish_editor"));
        if (curLen <= 280) {
            $("#publisher_info").html(normal);
            $("#publisher_info").find(".pipsLim").html(parseInt((280 - curLen) / 2));
            $("#publisher_info").removeClass("error");
            if (curLen != 0) {
                $(".postBtnBg").removeClass("bgColorA_No");
            }
            else {
                $(".postBtnBg").addClass("bgColorA_No");
            }
            return true;
        }
        else {
            $("#publisher_info").html(error);
            $("#publisher_info").find("span").html(parseInt((curLen - 280 + 1) / 2));
            $("#publisher_info").addClass("error");
            $(".postBtnBg").addClass("bgColorA_No");
            return false;
        }

    }
};
var bufferCount = 0;
var isLoaded = true;

var ajaxGetMiniBlog = function (ishashchange, isBufferRetry) {

    var url;
    if (!window.location.hash || window.location.hash.indexOf('#!') < 0) {
        url = window.location.href;
        if (ishashchange) {
            $(window).scrollTop(0);
            $("a[action]").removeClass("current");
            $("a[action='all']").attr("class", "current");
            var oriUrl = window.location.href.replace(App.config.Domain, "").replace(/#/g, "");
            var curTab = $("li[isall='1']"); var preTab = $(".nfTagB .current");
            if (!preTab.attr("isall")) {
                if (curTab[0]) {
                    if (preTab.attr("isfriend")) {
                        $('<li isfriend="1"><a href="#!' + oriUrl + '?IsFriendShip=1">相互关注</a></li><li class="MIB_line_l">|</li>').insertAfter(preTab);
                        preTab.remove();
                    } else {
                        var preGid = preTab.attr("gid");
                        var preTxt = preTab.find("span").text();
                        $('<li gid="' + preGid + '"><a href="#!' + oriUrl + '?gid=' + preGid + '">' + preTxt + '</a></li><li class="MIB_line_l">|</li>').insertAfter(preTab);
                        preTab.remove();
                    }
                }
                $('<li class="current" isall="1"><span>所有分组</span></li>').insertAfter(curTab.next());
                curTab.next().remove();
                curTab.remove();
                $("a[action]").each(function () {
                    if ($(this).attr("action") != "all")
                        $(this).attr("href", "#!" + oriUrl + "?" + $(this).attr("action") + "=1");
                    else
                        $(this).attr("href", "#");
                });
            }
        }
    }
    else {
        url = window.location.href.replace(App.config.Domain, "").split('!')[1];
        if (ishashchange) {
            $(window).scrollTop(0);
            var urlJson = App.UlrToJson(url);

            $("a[action]").removeClass("current");
            if (!urlJson) {
                $("a[action='all']").attr("class", "current");
            }
            else {
                if (!urlJson["IsAdvanced"]) {
                    var isAll = 1;


                    for (var p in urlJson) {
                        var elem = $("a[action='" + p + "']");
                        if (elem[0]) {
                            isAll = 0;
                            elem.attr("class", "current");
                        }
                    }
                    if (isAll)
                        $("a[action='all']").attr("class", "current");
                    else
                        $("a[action='all']").removeClass("current");
                }

                if (urlJson["gid"]) {
                    var curTab = $("li[gid='" + urlJson["gid"] + "']");
                    var oriUrl = url.split('?')[0];
                    if (curTab[0]) {
                        if (!curTab.attr("pop")) {
                            if (!curTab.attr("class")) {
                                var preTab = $(".nfTagB .current");
                                if (preTab[0]) {

                                    if (preTab.attr("isall")) {
                                        $('<li isall="1"><a href="#">所有分组</a></li><li class="MIB_line_l">|</li>').insertAfter(preTab);
                                        preTab.remove();
                                    }
                                    else if (preTab.attr("isfriend")) {
                                        $('<li isfriend="1"><a href="#!' + oriUrl + '?IsFriendShip=1">相互关注</a></li><li class="MIB_line_l">|</li>').insertAfter(preTab);
                                        preTab.remove();
                                    }
                                    else {
                                        var preGid = preTab.attr("gid");
                                        var preTxt = preTab.find("span").text();
                                        $('<li gid="' + preGid + '"><a href="#!' + oriUrl + '?gid=' + preGid + '">' + preTxt + '</a></li><li class="MIB_line_l">|</li>').insertAfter(preTab);
                                        preTab.remove();
                                    }
                                }

                                var txt = curTab.find("a").text();
                                $('<li gid="' + urlJson["gid"] + '" class="current"><span title="' + txt + '">' + txt + '<a class="arrow" onclick="$(this).parent().next().show();return false;" id="btnManageGroup" href="javascript:void(0);"><cite class="arr_m"></cite></a></span><ul style="display: none;" class="sltmenu"><li><a href="' + App.config.curUid + '/Follow?gid=' + urlJson["gid"] + '"><img src="/Content/Image/transparent.gif" class="iconsetup" title="管理分组">管理分组</a></li></ul></li>').insertAfter(curTab.next());
                                curTab.next().remove();
                                curTab.remove();

                                App.elemBlur($(".sltmenu"), $("#btnManageGroup"));
                            }
                        }
                        else {
                            var preTab = $(".nfTagB .current");
                            if (preTab[0]) {
                                if (preTab.attr("isall")) {
                                    $('<li isall="1"><a href="#">所有分组</a></li><li class="MIB_line_l">|</li>').insertAfter(preTab);
                                    preTab.remove();
                                }
                                else if (preTab.attr("isfriend")) {
                                    $('<li isfriend="1"><a href="#!' + oriUrl + '?IsFriendShip=1">相互关注</a></li><li class="MIB_line_l">|</li>').insertAfter(preTab);
                                    preTab.remove();
                                }
                                else {
                                    var preGid = preTab.attr("gid");
                                    var preTxt = preTab.find("span").text();
                                    $('<li gid="' + preGid + '"><a href="#!' + oriUrl + '?gid=' + preGid + '">' + preTxt + '</a></li><li class="MIB_line_l">|</li>').insertAfter(preTab);
                                    preTab.remove();
                                }
                            }

                            var more = $("li[tip='1']");
                            var curTxt = curTab.find("a").text();
                            var lastGid = more.prev().prev().attr("gid");
                            var lastTxt = more.prev().prev().find("a").text();
                            more.prev().remove(); more.prev().remove();
                            $('<li gid="' + urlJson["gid"] + '" class="current"><span title="' + curTxt + '">' + curTxt + '<a class="arrow" onclick="$(this).parent().next().show();return false;" id="btnManageGroup" href="javascript:void(0);"><cite class="arr_m"></cite></a></span><ul style="display: none;" class="sltmenu"><li><a href="' + App.config.curUid + '/Follow?gid=' + urlJson["gid"] + '"><img src="/Content/Image/transparent.gif" class="iconsetup" title="管理分组">管理分组</a></li></ul></li>').insertBefore(more);
                            App.elemBlur($(".sltmenu"), $("#btnManageGroup"));

                            $('<li class="txt" gid="' + lastGid + '" pop="1"><a href="#!' + oriUrl + '?gid=' + lastGid + '">' + lastTxt + '</a></li>').insertBefore(curTab);
                            curTab.remove();
                        }
                        $("a[action]").each(function () {
                            if ($(this).attr("action") != "all")
                                $(this).attr("href", "#!" + oriUrl + "?" + $(this).attr("action") + "=1&gid=" + urlJson["gid"]);
                            else
                                $(this).attr("href", "#!" + oriUrl + "?" + "gid=" + urlJson["gid"]);
                        });
                    }
                }

                if (urlJson["IsFriendShip"]) {
                    var oriUrl = url.split('?')[0];
                    var curTab = $("li[isfriend='1']"); var preTab = $(".nfTagB .current");
                    if (curTab[0]) {
                        if (!curTab.attr("class")) {
                            if (preTab.attr("isall")) {
                                $('<li isall="1"><a href="#">所有分组</a></li><li class="MIB_line_l">|</li>').insertAfter(preTab);
                                preTab.remove();
                            } else {
                                var preGid = preTab.attr("gid");
                                var preTxt = preTab.find("span").text();
                                $('<li gid="' + preGid + '"><a href="#!' + oriUrl + '?gid=' + preGid + '">' + preTxt + '</a></li><li class="MIB_line_l">|</li>').insertAfter(preTab);
                                preTab.remove();
                            }

                            $('<li class="current" isfriend="1"><span>相互关注</span></li>').insertAfter(curTab.next());
                            curTab.next().remove();
                            curTab.remove();
                            $("a[action]").each(function () {
                                if ($(this).attr("action") != "all")
                                    $(this).attr("href", "#!" + oriUrl + "?" + $(this).attr("action") + "=1&IsFriendShip=1");
                                else
                                    $(this).attr("href", "#!" + oriUrl + "?IsFriendShip=1");
                            });

                        }
                    }
                }
            }
        }
    }

    var loadMB = $("#loadMB");
    var loadError = $("#loadError");
    var loadNoResult = $("#loadNoresult");

    var loadMB1 = $("#loadMB1");
    var loadError1 = $("#loadError1");
    var loadNoResult1 = $("#loadNoresult1");
    if (ishashchange) {
        bufferCount = 0;
        loadMB.show();
        loadError.hide();
        loadNoResult.hide();
    }
    else {
        if (!isBufferRetry)
            bufferCount++;
        loadMB1.show();
        loadError1.hide();
        loadNoResult1.hide();
    }
    url = App.AddQueryToUrl(url.replace(/#/g, ""), "Buffer", bufferCount);
    isLoaded = false;
    $.ajax({
        dataType: "json",
        url: url,
        cache: false,
        type: "get",
        success: function (o) {
            if (o.Code == "A00005") {
                if (ishashchange) {
                    loadMB.hide();
                    $(".MIB_feed").remove();
                    $("#page").remove();
                    $(o.Data).insertAfter(loadNoResult);
                    App.initMedia();
                    App.initNameCard($("#feed_list"));
                    loadMB1.remove();
                    loadNoResult1.remove();
                    loadError1.remove();
                }
                else {
                    $(o.Data).insertAfter(loadNoResult1);
                    App.initMedia("feed_list" + bufferCount);
                    App.initNameCard($("#feed_list" + bufferCount));
                    loadMB1.remove();
                    loadNoResult1.remove();
                    loadError1.remove();
                }
            }
            else {
                if (ishashchange) {
                    loadMB.hide();
                    loadNoResult.show();
                }
                else {
                    loadMB1.hide();
                    loadNoResult1.show();
                }
            }
            isLoaded = true;
        },
        error: function () {
            if (ishashchange) {
                loadMB.hide();
                loadNoResult.hide();
                loadError.show();
            }
            else {
                loadMB1.hide();
                loadNoResult1.hide();
                loadError1.show();
            }
            isLoaded = true;
        }
    });
};
$(document).ready(function () {
    publish_editor = $("#publish_editor")[0];
    $("#publisher_faces").click(function (e) {
        e.stopPropagation();
        return App.showExpression($("#publish_editor"), this);
    });

    $("#publisher_pic").click(function (e) {
        e.stopPropagation();
        return App.showPicUpload(this);
    });


    $("#publisher_video").click(function (e) {
        e.stopPropagation();
        return App.ShowVideoDiaDiv($("#publish_editor"), this);
    });
    $("#publisher_music").click(function () {
        return App.showMusicDiaDiv($("#publish_editor"), this);
    });
    $("#publisher_vote").click(function () {
        return App.showVote($("#publish_editor"), this);
    });
    App.bindTxtarea($("#publish_editor")[0]);
    $("#publisher_topic").click(function () {
        App.insertTopic($("#publish_editor")[0]);
    });
    $("#publisher_submit").click(function () {
        if ($("#publish_editor").val() == "") {
            App.highLineTxtBox($("#publish_editor"));
            return;
        }
        curTxt = "";
        if (!checkTxtLen()) {
            App.alert("超过字数了");
            return;
        }
        App.disableAtag($(this));
        App.CreateOriginalMiniBlog($("#publish_editor"), function () {
            App.tip("发布成功", 1000, window.location.href);
            $("#publish_editor").val("");
        }, function () {
            App.enableAtag($("#publisher_submit"));
        });
    });



    App.TimerFunArray.push(checkTxtLen);
    App.TimerFunArray.push(App.ajaxAtWho);
    App.StartTimer();
    App.bindGoTop(curBorder);

    $(window).hashchange(ajaxGetMiniBlog);
    ajaxGetMiniBlog(true);
    $(window).scroll(function () {
        if ($("#loadMB1")[0]) {
            if ($(this).scrollTop() + $(this).height() > $("#loadMB1").offset().top) {
                if (bufferCount < 3 && isLoaded) {
                    ajaxGetMiniBlog();
                }
            }
        }
    });
});

window.onload = function () {
    var voteItems = $("div[type='vote']");
    for (var i = 0; i < voteItems.length; i++) {
        var img = $(voteItems[i]).find("img")[0];
        var img1 = $(voteItems[i]).find("img")[1];

        $(img1).css("left", parseInt(($(img).width() - 33) / 2)).css("top", parseInt(($(img).height() - 33) / 2)).css("position", "absolute");
        $(img1).show();
    }
};







var btnMore = $(".moreti");
var groupList = $(".nfTaglay");
var groupItem = $(".sltmenu");
var btnMagGroup = $("#btnManageGroup");
if (groupItem[0] != null && btnMagGroup[0] != null) {
    groupItem.JQP_ClickOther(function () {
        groupItem.hide();
    });
    btnMagGroup.click(function (e) {
        e.stopPropagation();
        groupItem.show();
    });
}
$("#MIB_creategroup").click(function () {
    App.popGroupDiv();
});

App.lazyEvent(btnMore, "mouseenter", "mouseleave", 500, function () {
    groupList.css("left", $(btnMore).offset().left - 25).css("top", $(btnMore).offset().top + 20).show()
}, function () { App.lazyFunction(function () { groupList.hide(); }, 500) });
App.lazyEvent(groupList, "mouseleave", "mouseenter", 500, function () {
    groupList.hide();
});
var GroupSortCon = '<div class="layerBox"><div class="layerBoxTop"><div class="topCon"><strong>调整分组顺序</strong><a title="关闭" class="close" href="javascript:;"></a><div class="clear"></div></div></div><div class="layerBoxCon" style="width: 440px; height: auto;"><div class="friexpicbor">				  <div class="friexpic">					<h3>首页分组显示预览</h3>					<div class="fbTagB">					  <ul id="ul_oriderLists"><li class="current"><span>所有分组 </span></li><li>更多</li></ul>					 </div>					</div>				</div><div class="friLayBox">                <div class="frileft">                  <ul class="frititle" id="mpop_ul_frititle">                    <li>分组名</li>                  </ul>                  <div class="friList">					<ul id="group_ul_lists">载入中。。。</ul>                  </div>                </div>                <div class="friright">                  <a class="btn_notclick" href="javascript:void(0)" id="orderup"><em><img title="" class="chupdwn_icon dch_icon" src="/Content/Image/transparent.gif">上移</em></a>                  <a class="btn_notclick" href="javascript:void(0)" id="orderdown"><em><img src="/Content/Image/transparent.gif" class="chupdwn_icon uch_icon" title="">下移</em></a>               </div>                <p class="btn" id="mpop_p_btn"><a class="newabtngrn" href="javascript:void(0)" id="gosave"><em>保存</em></a><a class="btn_normal btns" href="javascript:void(0)" id="gocancel"><em>取消</em></a></p>              </div>			</div></div>';
$("#Adjust_group_order").click(function () {
    if (App.initDialDiv("GroupSortBox", dialDiv, false, null)) {
        var groupDiv = $("#GroupSortBox");
        groupDiv.removeClass("4CancelAllLayer");
        groupDiv.find(".mid_c").html(GroupSortCon);
        $("#GroupSortBox .close").add($("#gocancel")).click(function () {
            groupDiv.remove();
            App.hideMash();
            return false;
        });
        var position = App.centerInScreen(groupDiv);
        groupDiv.css("left", position.left + "px");
        groupDiv.css("top", position.top + "px");
        App.showMash(true);
        $.ajax({
            dataType: "json",
            url: "/Ajax/GetAllGroup/",
            cache: false,
            data: { fuid: 0 },
            type: "post",
            success: function (o) {
                if (o.Code == "A00005") {
                    var groupCount = o.Data.length;
                    var up = $("#orderup").click(function () {
                        if (this.className != "btn_notclick") {
                            var sel = list.find(".down").parent();
                            var clone = sel.clone()
                            clone.insertBefore(sel.prev()).find("a").mousedown(mouseDown);
                            sel.remove();
                            preview();
                            enableBtn(clone);
                        }
                        return false;
                    });
                    var down = $("#orderdown").click(function () {
                        if (this.className != "btn_notclick") {
                            var sel = list.find(".down").parent();
                            var clone = sel.clone();
                            clone.insertAfter(sel.next()).find("a").mousedown(mouseDown);
                            sel.remove();
                            preview();
                            enableBtn(clone);
                        }
                        return false;
                    });
                    $("#gosave").click(function () {
                        if (this.locked)
                            return false;
                        this.locked = true;
                        alink = this;
                        var as = list.find("a");
                        var gids = "";
                        for (var i = 0; i < as.length; i++) {
                            gids += $(as[i]).attr("gid") + ",";
                        }
                        $.ajax({
                            dataType: "json",
                            url: "/Ajax/SortGroup/",
                            cache: false,
                            data: { gids: gids },
                            type: "post",
                            success: function (o) {
                                if (o.Code == "A00004") {
                                    App.fullTip(CodeList["A00004"], 1000, window.location.href.replace("#", ""), 3);
                                }
                                else if (o.Code == "A00001") {
                                    App.showLoginDial();
                                }
                                else {
                                    App.fullTip(CodeList["A00003"], 1000, null, 1);
                                }
                                alink.locked = false;
                            },
                            error: function () {
                                App.fullTip(CodeList["A00003"], 1000, null, 1);
                                alink.locked = false;
                            }
                        });
                        return false;
                    });
                    var top = $("#ul_oriderLists");
                    var list = $("#group_ul_lists");
                    var preview = function () {
                        var as = list.find("a");
                        if (as.length <= 3) {
                            for (var i = 0; i < as.length; i++) {
                                $(top.find("li")[2 * i + 1]).text($(as[i]).text());
                            }
                        }
                        else {
                            for (var i = 0; i < 3; i++) {
                                $(top.find("li")[2 * i + 1]).text($(as[i]).text());
                            }
                        }
                    }
                    var enableBtn = function ($elems) {
                        var index = list.find("li").index($elems);
                        if (index == 0) {
                            up.attr("class", "btn_notclick");
                        }
                        else {
                            up.attr("class", "btn_normal");
                        }
                        if (index == groupCount - 1) {
                            down.attr("class", "btn_notclick");
                        }
                        else {
                            down.attr("class", "btn_normal");
                        }
                    }
                    var mouseDown = function (e) {
                        list.find("a").attr("class", "").bind("mousemove", mouseMove);
                        $(".frititle  li").bind("mousemove", mouseMove);
                        this.className = "down";
                        enableBtn($(this).parent());
                        $(document).bind("mouseup", mouseUp);
                        if (this.style)
                            this.style.MozUserSelect = "none";
                        return false;
                    }
                    var mouseMove = function (e) {
                        if ($(e.target).attr("tagName") == "LI") {
                            if (list.find("li:first").prev().attr("tagName") != "DIV") {
                                list.find("div").remove();
                                $('<div style="cursor: move; height: 3px; background-color: rgb(51, 102, 255); overflow: hidden;"></div>').insertBefore(list.find("li:first"));
                            }
                        }
                        else {
                            if ($(this).parent().next().attr("tagName") != "DIV") {
                                list.find("div").remove();
                                $('<div style="cursor: move; height: 3px; background-color: rgb(51, 102, 255); overflow: hidden;"></div>').insertAfter($(this).parent());
                            }
                        }

                    }
                    var mouseUp = function (e) {
                        list.find("a").unbind("mousemove", mouseMove);
                        $(".frititle li").unbind("mousemove", mouseMove);
                        $(document).unbind("mouseup", mouseUp);
                        var drag = list.find("div");
                        if (drag[0]) {
                            var selone = list.find(".down").parent();
                            var clone = selone.clone();
                            selone.remove();

                            clone.insertAfter(drag).find("a").mousedown(mouseDown);
                            drag.remove();
                            preview();
                            enableBtn(list.find(".down").parent());
                        }
                        if (this.style)
                            this.style.MozUserSelect = "";
                    }
                    list.html("");
                    if (o.Data.length > 0) {
                        for (var i = 0; i < o.Data.length; i++) {
                            var li = $('<li><a gid="{id}" href="javascript:void(0)"  style="">{name}</a></li>'.replace(/\{name\}/g, o.Data[i].Name).replace(/\{id\}/g, o.Data[i].ID));
                            list.append(li);
                            li.find("a").mousedown(mouseDown);
                            if (i < 3) {
                                var li1 = $('<li>{name}</li><li class="MIB_line_l">|</li>'.replace(/\{name\}/g, o.Data[i].Name));
                                li1.insertBefore(top.find("li:last"));
                            }
                        }
                    }
                }
                else if (o.Code == "A00001") {
                    App.showLoginDial();
                }
                else {
                    App.fullTip(CodeList["A00003"], 1000, null, 1);
                }
            },
            error: function () {
                App.fullTip(CodeList["A00003"], 1000, null, 1);
            }
        });
    }

});








$("#filter_adv_show").click(function () {
    $("#filter_adv_panel").fadeIn();
    $("#filter_key_panel").hide();
    return false;
});
$("#filter_adv_hide").click(function () {

    $("#filter_adv_panel").fadeOut(function () { $("#filter_key_panel").show(); });
    return false;
});
$("#filter_mkey_input").JQP_HighLineInput2({ nullCon: "搜索关注人说的话" }).keyup(function (e) {
    if (e.which == 13) {
        if (this.value && this.value != "搜索关注人说的话") {
            var url;
            if (window.location.href.indexOf("#!") >= 0) {
                url = "#!" + window.location.href.replace(App.config.Domain, "").split('!')[1];
            }
            else {
                url = "#!" + window.location.href.replace(App.config.Domain, "");
            }
            url = App.RemoveQueryFromUrl(window.location.href, "page");
            window.location.href = App.AddQueryToUrl(url, "Key", encodeURIComponent($.trim($(this).val()))); ;
        }
    }
});
var advSearch = function () {
    var url;
    if (window.location.href.indexOf("#!") >= 0) {
        url = "#!" + window.location.href.replace(App.config.Domain, "").split('!')[1];
    }
    else {
        url = "#!" + window.location.href.replace(App.config.Domain, "");
    }
    url = App.RemoveQueryFromUrl(window.location.href, "page");
    url = App.AddQueryToUrl(url, "IsAdvanced", "1");
    if (App.E("filter_ori").checked) {
        url = App.AddQueryToUrl(url, "IsOri", "1");
    }
    else {
        url = App.RemoveQueryFromUrl(url, "IsOri");
    }
    if (App.E("filter_ret").checked) {
        url = App.AddQueryToUrl(url, "IsRet", "1");
    }
    else {
        url = App.RemoveQueryFromUrl(url, "IsRet");
    }
    if (App.E("filter_text").checked) {
        url = App.AddQueryToUrl(url, "IsHaveLink", "1");
    }
    else {
        url = App.RemoveQueryFromUrl(url, "IsHaveLink");
    }
    if (App.E("filter_pic").checked) {
        url = App.AddQueryToUrl(url, "IsHavePic", "1");
    }
    else {
        url = App.RemoveQueryFromUrl(url, "IsHavePic");
    }
    if (App.E("filter_video").checked) {
        url = App.AddQueryToUrl(url, "IsHaveVideo", "1");
    }
    else {
        url = App.RemoveQueryFromUrl(url, "IsHaveVideo");
    }
    if (App.E("filter_music").checked) {
        url = App.AddQueryToUrl(url, "IsHaveMusic", "1");
    }
    else {
        url = App.RemoveQueryFromUrl(url, "IsHaveMusic");
    }
    if (App.E("filter_vote").checked) {
        url = App.AddQueryToUrl(url, "IsHaveVote", "1");
    }
    else {
        url = App.RemoveQueryFromUrl(url, "IsHaveVote");
    }

    if (App.E("filter_adv_input").value && App.E("filter_adv_input").value != "搜索关注人说的话") {
        url = App.AddQueryToUrl(url, "Key", encodeURIComponent($.trim(App.E("filter_adv_input").value)));
    }
    else {
        url = App.RemoveQueryFromUrl(url, "Key");
    }
    if (App.E("filter_adv_stime").value && App.E("filter_adv_stime").value != "选择日期") {
        url = App.AddQueryToUrl(url, "StartTime", App.E("filter_adv_stime").value);
    }
    else {
        url = App.RemoveQueryFromUrl(url, "StartTime");
    }
    if (App.E("filter_adv_etime").value && App.E("filter_adv_etime").value != "选择日期") {
        url = App.AddQueryToUrl(url, "EndTime", App.E("filter_adv_etime").value);
    }
    else {
        url = App.RemoveQueryFromUrl(url, "EndTime");
    }
    window.location.href = url;
}
$("#filter_adv_input").JQP_HighLineInput2({ nullCon: "搜索关注人说的话" }).keyup(function (e) {
    if (e.which == 13) {
        advSearch();
    }
});
$("#filter_adv_stime").JQP_HighLineInput2({ nullCon: "选择日期" }).JQP_DatePicker({ curDate: new Date() });
$("#filter_adv_etime").JQP_DatePicker({ curDate: new Date() });

$("#filter_mkey_btn").click(function () {
    if ($("#filter_mkey_input").val() != "搜索关注人说的话") {
        var url;
        if (window.location.href.indexOf("#!") >= 0) {
            url = "#!" + window.location.href.replace(App.config.Domain, "").split('!')[1];
        }
        else {
            url = "#!" + window.location.href.replace(App.config.Domain, "");
        }
        url = App.RemoveQueryFromUrl(window.location.href, "page");
        window.location.href = App.AddQueryToUrl(url, "Key", encodeURIComponent($.trim($("#filter_mkey_input").val())));
    }
    return false;
});
$("#filter_adv_btn").click(function () {
    advSearch();
    return false;
});
                      